<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/11/9
 * Time: 17:44
 */

namespace app\mall\service;


class BaseService
{
    protected $error;

    /**
     * 设置错误信息
     * @param $error
     * @return bool
     */
    protected function setError($error)
    {
        empty($this->error) && $this->error = $error;
        return false;
    }

    /**
     * 获取错误信息
     * @return mixed
     */
    public function getError()
    {
        return $this->error;
    }

    /**
     * 是否存在错误
     * @return bool
     */
    public function hasError()
    {
        return !empty($this->error);
    }

    /**
     * @return string
     * 订单号生成
     */
    public function order_sn()
    {
        return '4200000' . rand(111, 999) . date('YmdHis') . rand(1111, 9999);
    }

}
